<?php
/**
 * 地址库
 * User: dxk
 * Date: 2020/07/17
 */
namespace App\Http\Controllers\Service;

use App\Http\Controllers\Controller;
use App\Model\Core\Logistics\AreaMap;
use App\Service\Core\Logistics\AreaMapService;
use Illuminate\Http\Request;

class AreaMapController extends Controller
{
    /**
     * 获取子级区域
     * @param Request $request
     * @return array
     */
    public function ajaxGetSubArea(Request $request)
    {
        $area_parent_id = trim($request->input('id'));
        if (!is_numeric($area_parent_id) || $area_parent_id <= 0) {
            return alert_info(404, '未找到');
        }
        $AreaMapService = new AreaMapService();
        $html = $AreaMapService->getSubAreaHtml($area_parent_id);
        if (empty($html)) {
            return alert_info(100, '没有了');
        }
        return alert_info(0, '', $html);
    }
}
